﻿//*** Guidance generated code ***//
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;

using ProjectBase.Core;
using ProjectBase.Core.Dao;
using ProjectBase.Data.NH;

namespace $safeprojectname$.Sessions
{
    /// <summary>
    ///     Class which setups the NHibernate factory with the simple session storage.
    ///     Useful for batch or test projects
    /// </summary>
    public static class NHSimpleSession
    {
        static INHRequestSession _simpleSession;

        /// <summary>
        ///     Setups the simple session.
        /// </summary>
        public static void Initialize()
        {
            if (_simpleSession.IsNull())
            {
                _simpleSession = new SimpleSessionStorage();

                NHSessionFactory.Initialize(_simpleSession);
            }

            NHSession.Clear();
        }
    }
}